1. Field of the Invention
The present invention relates generally to a computer implemented method, data processing system, and computer program product for prioritizing and harmonizing access to a common resource by multiple processors executing instructions. More specifically, the present invention relates to serializing process calls to an I/O adapter.
2. Description of the Related Art
Modern data processing systems use more processors than the generation of data processing systems of a decade ago. IC Integrated circuit miniaturization has made the practice of including multiple cores on a die the norm, rather than the exception. Consequently, a typical data processing system can have multiple processes executing on multiple processors. Nevertheless, for communication purposes, there can be a fewer number of I/O adapters than there are processes in a data processing system. As a result, in conventional data processing systems, arbitration between competing processes is performed to enhance reliable access to the I/O adapter. An I/O adapter is a physical network interface that provides memory-mapped input/output interface for placing queues into physical memory and provides an interface for control information. Control information can be, for example, a selected interrupt to generate when a data packet arrives.
FIG. 2A is a prior art device driver 201 for I/O adapter 221. I/O adapter 221 receives service requests or process calls from several processes 211, 212, 213, and 214. Each process call provides at least one transmit packet to device driver 201 in order for the device driver to place the data of each transmit packet into the memory or registers of I/O adapter 221. I/O adapter 221, in turn, transmits the packet to a network media, including, for example, wired, and wireless media.
FIG. 2B is the flowchart for each process that makes the call to the adapter. Initially, the process determines if a lock is free (step 251). The lock is a memory location that all processes refer to when making a call to the I/O adapter. Only one process may set or acquire the lock at a time. The lock helps prevent a first process from writing or otherwise passing data to the I/O adapter at the same time a second process writes or otherwise passes data to the I/O adapter. A first arriving process may reach a positive determination at step 251. Accordingly, the first process may next perform the next process step (step 252) to acquire the lock, and then proceed to the next process step 253. In contrast, a second arriving process, for example, process 2 212, of FIG. 2A, may determine that the lock is not free, and proceed to re-determine whether the lock is free by having the processor that performs the process 2 212 instructions again perform step 251 as the next step after step 251. The term “spin lock” is commonly used in the field of computer programming to describe process steps 251 and 252. In other words, a spin lock is a sequence of machine instructions performed by a processor that includes a test to determine whether a target resource is available.